<?php
	require_once($GLOBALS['BIB'].'Pr_db/pr_historics.mex');
	$RegID = 0;
	$PID = 395;
	if($GLOBALS['MYT']->db_query("UPDATE systemoffice.staff_members SET smb_Flag = 5, 
										smb_DesmissDate = '{$_POST['smb_DesmissDate']}',
										smb_DesmissType = {$_POST['smb_DesmissType']},
										smb_DesmissDateOut = '{$_POST['smb_DesmissDateOut']}',
										smb_DesmissMotive = '{$_POST['smb_DesmissMotive']}'
									WHERE smb_ID = {$_POST['MemberID']}")==true) {
		$GLOBALS['MYT']->db_query("INSERT INTO systemoffice.timeclock_staffoff (tsv_Flag, tsv_Member, tsv_Domain, tsv_DateStart, tsv_DateEnd, tsv_Process, tsv_Observations, tsv_User)
		VALUES (1,{$_POST['MemberID']},'{$_POST['MemberDomain']}','{$_POST['smb_DesmissDate']}','{$_POST['smb_DesmissDateOut']}',{$PID},'',{$_SESSION[$SESSID]})");
				$GetEdit = $GLOBALS['MYT']->db_array("SELECT smb_ID, smb_Name, smb_DesmissDateOut
					FROM systemoffice.staff_members 
					LEFT OUTER JOIN systemoffice.main_offices ON office_number = smb_Domain
					WHERE smb_ID = {$_POST['MemberID']}");
				systemchange_hs('STAFF_MEMBERDESMISS',$_POST['MemberID']);			
				$RegID = $_POST['MemberID'];
				$TaskTime = $_POST['smb_DesmissDateOut'];
				echo '<div class="Confirm">Guardado.</div>';
	}
	if ($RegID != 0) {
	include($GLOBALS['BIB'].'Pr_db/prc_modules/rh_comunication.php');
	}